import os,time
from 查找没用的图片 import listDir
from tkinter import messagebox
# print(time.asctime(time.localtime(t)))


def checkDir(dir):
    allSourceFiles = listDir(dir,extensions=["txt"],reuslts = [])
    m = 180
    for x in allSourceFiles:
        t = os.stat(x).st_atime
        m = min(int(time.time()-t), m)
    print(f"{dir}:{m}")
    if m > 120:
        messagebox.showinfo("提示",f"{dir}出错")
    return m > 120

isStop = False
while True:
    if not isStop:
        if checkDir('/Users/wangshuguan/Desktop/四川'):
            isStop = True
        if checkDir('/Users/wangshuguan/Desktop/辽宁企业'):
            isStop = True
        time.sleep(20)
# 
# os.system("open -a Terminal \"`/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 /Users/wangshuguan/Workplace/pythonUtil/中标抓数据/江苏省资质信息.py`\"")
